/* 
    Created on : 12.12.2014, 15:42:32
    Author     : oren.ginger@gmail.com
*/

@import "reset.scss";
@import "../fonts/ubuntu.scss";
@import "../fonts/comfortaa.scss";

$brand_color_light          :   #006600;
$brand_color_dark           :   #004A00;
$light_color                :   #fff;
$page_background_dark       :   #EDEEED;
$help_color                 :   #0066CC;

$border_color               :   #555;

$standard_shadow_color      :   rgba(0, 0, 0, .4);
$standard_shadow            :   0 0 4px 2px $standard_shadow_color;
$standard_padding           :   12px;

$header_height              :   48px;
$header_font_size           :   24px;
$header_text_shadow         :   0 0 3px #000;

$content_font_size          :   9pt;
$default_font               :   'Ubuntu', sans-serif;
$header_font                :   'Comfortaa', cursive;

$tile_margin                :   12px;

/* Form elements */
$button_color_light         :   #555;
$button_color_dark          :   #333;
$button_min_width           :   120px;
$input_color_light          :   #eee;
$input_color_dark           :   #ddd;
$control_active_color       :   #0066CC;

$modal_background           :   rgba(255,255,255,.95);

$footer_height              :   36px;
$footer_font_size           :   9pt;

@mixin standard_gradient($color1, $color2) {
    background-image: -ms-linear-gradient(top, $color1, $color2);
    background-image: -o-linear-gradient(top, $color1, $color2);
    background-image: -moz-linear-gradient(top, $color1, $color2);
    background-image: -webkit-linear-gradient(top, $color1, $color2);
    background-image: linear-gradient(top, $color1, $color2);
}

@mixin width_calc($expression) {
    width: -webkit-calc($expression);
    width: -moz-calc($expression);
    width: calc($expression);
}

@mixin translate($x, $y) {
    -moz-transform: translate($x, $y);
    -ms-transform: translate($x, $y);
    -webkit-transform: translate($x, $y);
    -o-transform: translate($x, $y);
    transform: translate($x, $y);
}

@mixin control_shadow($color) {
    box-shadow: 0 0 2px 1px $color;
}

* {
    box-sizing: border-box;
    z-index: 50;
    position: relative;
}

html {
    min-height: 100%;
    height: 100%;
    
    body {
        min-height: 100%;
        position: relative;
        width: 100%;
        background-image: url('../img/bg/palms.jpg');     
        background-attachment: fixed;
        background-clip: border-box;
        background-position: center center;
        background-size: cover;
        
        header {
            height: $header_height;
            line-height: $header_height;
            color: $light_color;
            @include standard_gradient($brand_color_light, $brand_color_dark);
            box-shadow: $standard_shadow;
            text-shadow: $header_text_shadow;            
            
            container > * {
                display: inline-block;
            }
            
            h1 {
                font-size: $header_font_size;
                font-weight: bold;
                padding-left: $standard_padding;
            }
        }
        
        .content {
            min-height: 100%;
            font-family: $default_font;
            font-size: $content_font_size;
            padding-top: $tile_margin;
            margin-bottom: -$footer_height;
            padding-bottom: $header_height + $footer_height;
            
            & > .clear {
                min-height: $header_height;
            }
            
            .tile {
                background: $modal_background;
                border-radius: $standard_padding;
                box-shadow: $standard_shadow;
                padding: $standard_padding;
                margin-bottom: $tile_margin;
                
                h1 {
                    margin-bottom: $standard_padding;
                    font-size: 150%;
                }
                
                h2 {
                    margin: $standard_padding 0;
                    font-size: 125%;
                }
                
                .stats {
                    position: relative;
                    
                    &:after {
                        clear: both;
                        display: block;
                        content: '';
                        height: $standard_padding;
                    }

                    .key {
                        clear: both;
                        max-width: 66%;
                        float: left;
                    }
                    .value {
                        max-width: 33%;
                        float: right;
                    }
                }
                
                select.form-control {
                    width: 100%;
                }
            
                a {
                    color: blue;
                    text-decoration: underline;

                    &:visited {
                        color: darkviolet;
                    }
                }
            }
        }
        
        
        .footer {
            font-family: $default_font;
            text-shadow: $header_text_shadow;            
            position: absolute;
            bottom: 0;
            clear: both;
            min-height: $footer_height;
            font-size: $footer_font_size;
            color: $light_color;
            line-height: $footer_height;
            width: 100%;
            @include standard_gradient($brand_color_light, $brand_color_dark);
            box-shadow: $standard_shadow;
            
            .container {
                border-color: transparent;
                border-style: solid;
                border-width: 0 $standard_padding;
            }
            
            .license {
                float: right;
                
                a {
                    text-decoration: underline;
                }
            }
        }
    }
}

.container {
    padding: 0 $standard_padding;
    width: 100%;
    margin: 0 auto;
}

p {
    margin: $standard_padding 0;
}

.icon {
    height: 0.75em;
    width: 0.75em;
    display: inline-block;
    background-size: contain;
    background-position: left bottom;
    background-repeat: no-repeat;
    
    &.brand {
        background-image: url('../img/icon.png');
        background-image: url('../img/icon.svg');
    }
}

a, a:hover, a:active {
    color: inherit;
    text-decoration: none;
    outline: none;
}

p, li {
    line-height: 150%;
}

.clear {
    clear: both;
}

ul {
    list-style: disc;
    list-style-position: inside;
}

h1, h2, h3, h4 {
    font-family: $header_font;
}

.button{
    color: $light_color !important;
    text-shadow: $header_text_shadow;                    
    display: block;
    width: 100%;
    text-align: center;
    padding: $standard_padding 0;
    margin-bottom: $standard_padding / 2;
    font-size: $content_font_size;
    @include standard_gradient($button_color_light, $button_color_dark);
    border: $border_color 1px solid;
    border-radius: $standard_padding / 2;
    cursor: pointer;

    &:hover {
        background: $button_color_light;
    }

    &:active {
        @include standard_gradient($button_color_dark, $button_color_light);
        outline: none;
    }

    &.inline {
        display: inline-block;
        width: auto;
        min-width: $button_min_width;
        margin: $standard_padding 0 0;
        padding: $standard_padding / 2;
    }
    
    &.small {
        top: -1px;          // I am sorry
        min-width: 0;
        margin: 0;
    }
    
    &.primary {
        @include standard_gradient($brand_color_light, $brand_color_dark);
    }
    &.primary:hover {
        background: $brand_color_light;
    }
    &.primary:active {
        @include standard_gradient($brand_color_dark, $brand_color_light);
    }
}

.button-group {
    
    &.inline {
        min-width: $button_min_width;
        width: auto;
        display: inline-block;
        margin: 0;
        padding: $standard_padding / 2;
        
        .button {
            padding: $standard_padding / 2;
        }
        
        .open-group {
            padding-right: $standard_padding * 2;
        }
        
        .open-group:after {
            content: '▾';
        }
    }
    
    .open-group:after {
        content: '▼';
        position: absolute;
        right: $standard_padding;
        
        &.inline {
        }
    }
    
    &.open {
        .open-group {
            @include standard_gradient($button_color_dark, $button_color_light);
        }
        
        .button-group-menu {
            display: block;
        }
    }
    
    &.up {
        .button-group-menu {
            bottom: 100%;
        }
        
        .open-group:after {
            content: '▲';
        }
        
        &.inline {
            .open-group:after {
                content: '▴';
            }
        }
    }

    .button-group-menu {
        display: none;
        border: $border_color 1px solid;
        border-radius: $standard_padding / 2;
        overflow: hidden;
        position: absolute;
        padding: 0;
        margin: 0;
        width: 100%;
        z-index: 975;
        box-shadow: $standard_shadow;
        @include standard_gradient($button_color_light, $button_color_dark);

        .button {
            background: none;
            border: none;
            border-radius: 0;
            margin: 0;
            &:hover {
                background: $button_color_light;
            }
        }
    }
}

.modal {
    position: fixed;
    left: 50%;
    top: 50%;
    background: $modal_background;
    z-index: 1000;
    @include translate(-50%, -50%);
    border-radius: $standard_padding / 2;
    overflow: hidden;
    display: none;
    
    &[data-role="nojs"] {
        display: block;
    }
    
    header {
        height: $header_height * 0.8;
        box-shadow: none;
        h1 {
            display: inline-block;
            font-size: $header_font_size * 0.8;
            line-height: $header_height * 0.8;
        }
    }
    
    .content {
        margin-bottom: 0;
        padding: $standard_padding;
        p {
            padding: 0 $standard_padding;
        }
        
        input {
            width: 100%;
        }
    }
}

.modal-backdrop {
    background: $standard_shadow_color;
    z-index: 950;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    
    &[data-role="nojs"] {
        display: block;
    }    
}

form {
    .form-table {
        fieldset {
            display: block;
            border: $standard_shadow_color 1px solid;
            padding: $standard_padding;
            border-radius: $standard_padding / 2;
        }
        
        .cell {
            margin-bottom: $standard_padding;
            padding: 0 $standard_padding / 2;
            float: left;
            
            label {
                display: block;
                text-align: center;
                width: 100%;
                margin-bottom: $standard_padding / 2;
            }
            input, .button {
                display: block;
                width: 100%;
            }
        }
    }
}

.help {
    cursor: help;
    
    &label {
        left: -.75em;
    }
}

.help:after {
    position: absolute;
    content: '?';
    font-weight: bold;
    padding: 1px;
    width: 1em;
    height: 1em;
    border-radius: 1em;
    margin-left: .5em;
    background: $help_color;
    color: #fff;
    text-align: center;
    line-height: 1em;
}

input {
    @include standard_gradient($input_color_dark, $input_color_light);
    border: 1px solid $input_color_dark;
    padding: $standard_padding / 2;
    border-radius: $standard_padding / 2;
    font-size: inherit;
    
    &:active, &:focus {
        @include control_shadow($standard_shadow_color);
    }
}

.report {
    border: $input_color_light 1px solid;
    border-radius: $standard_padding / 2;
    overflow: hidden;
}

.report table {
    width: 100%;
    tr { 
        td {
            padding: $standard_padding;
        }
    
        &:hover {
            background: $input_color_dark !important;
        }
        
        &:nth-child(2n) {
            background: $input_color_light;
        }
        
        &.discount, &.total {
            td:first-child {
                text-align: right;
            }
            
            font-weight: bold;
        }
    }
}




@media screen and (max-width: 660px) {
    .modal {
        left: 1%;
        right: 1%;
        top: 1%;
        @include translate(0, 0);
    }
    
    .big-screen {
        display: none;
    }
    
    .tile {
        width: 100% !important;
    }
    
    form .form-table .cell {
        width: 100% !important;

        &.small {
            width: 33.3% !important;
        }
    }
    
    footer .license {
        float: none !important;
        display: block;
    }
}

@media screen and (min-width: 661px) {
    .small-screen {
        display: none;
    }
    
    .container {
        margin: 0 auto;
    }
    
    .content {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .tile {
        float: left;
        margin: $tile_margin;
    }
}


@media screen and (min-width: 661px) and (max-width: 720px) {
    .container {
        width: 660px;
    }
    
    .tile {
        &.wide {
            width: 660px - 2 * $tile_margin;
        }
        
        &.large {
            width: 440px - 2 * $tile_margin;
        }
        
        &.small {
            width: 220px - 2 * $tile_margin;
        }
    }
}

@media screen and (min-width: 721px) and (max-width: 980px) {
    .container {
        width: 720px;
    }
    
    .tile {
        &.wide {
            width: 720px - 2 * $tile_margin;
        }
        
        &.large {
            width: 480px - 2 * $tile_margin;
        }
        
        &.small {
            width: 240px - 2 * $tile_margin;
        }
    }
}

@media screen and (min-width: 981px) {
    .container {
        width: 980px;
    }
    
    .tile {
        &.wide {
            width: 980px - 2 * $tile_margin;
        }
        
        &.large {
            width: 652px - 2 * $tile_margin;
        }
        
        &.small {
            width: 326px - 2 * $tile_margin;
        }        
    }
}